#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;

char getChangedChar(char target, int swift) {
    int curr = (int)target + swift;
    while (curr < 'a') { curr += 26; }
    while (curr > 'z') { curr -= 26; }
    return (char)curr;
}

int main() {
    unordered_map<char, int> charsMap;
    string target; cin >> target;
    int swift; cin >> swift;
    string result = "";
    for (int i = 0; i < target.size(); i++) {
        if (charsMap.find(target[i]) == charsMap.end()) {
            charsMap.insert(pair<char, int>(target[i], 1));
        }
        else {
            charsMap[target[i]]++;
        }
    }
    for (int i = 0; i < target.size(); i++) {
        if (charsMap[target[i]] & 1) {
            result.push_back(getChangedChar(target[i], -swift));
        }
        else {
            result.push_back(getChangedChar(target[i], swift));
        }
    }
    cout << result;
    return 0;
}